<?php

declare(strict_types=1);

namespace Modules\Base\Models;

use Catch\Base\CatchModel as Model;

/**
 * @property $id
 * @property $fmaterial
 * @property $fnumber
 * @property $fname
 * @property $fspecification
 * @property $funit_number
 * @property $funit_name
 * @property $fuseorgid_name
 * @property $fbaseproperty_number
 * @property $fbaseproperty_name
 * @property $fdocumentstatus
 * @property $fforbidstatus
 * @property $fcasecode
 * @property $creator_id
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
*/
class Material extends Model
{


    protected $table = 'material';

    protected $fillable = [ 'id', 'fmaterial', 'fnumber', 'fname', 'fspecification', 'funit_number', 'funit_name', 'fuseorgid_name', 'fbaseproperty_number', 'fbaseproperty_name', 'fdocumentstatus', 'fforbidstatus', 'fcasecode', 'creator_id', 'created_at', 'updated_at', 'deleted_at' ];

    /**
     * @var array
     */
    protected array $fields = ['id','fnumber','fname','fspecification','funit_number','funit_name','fuseorgid_name','fbaseproperty_number','fbaseproperty_name','fdocumentstatus','fforbidstatus','fcasecode','created_at'];

    /**
     * @var array
     */
    protected array $form = ['fnumber','fname','fspecification','funit_number','funit_name','fuseorgid_name','fbaseproperty_number','fbaseproperty_name','fdocumentstatus','fforbidstatus','fcasecode'];

    /**
     * @var array
     */
    public array $searchable = [
        'fnumber' => '=',
        'fname' => 'like',
    ];

    /**
     * 时间格式化
     * @param $date
     * @return mixed
     */
    protected function serializeDate($date)
    {
        return $date->format('Y-m-d H:i');
    }

}
